package wang.conge.javasedemo.core.thread;

import java.util.concurrent.CyclicBarrier;

public class CyclicBarrierTest {

	public static void main(String[] args) {
		CyclicBarrier cyclicBarrier = new CyclicBarrier(5);

		for (int i = 0; i < 5; i++) {
			new Thread(()->{
				System.out.println("child thread start");
				
				try {
					cyclicBarrier.await();
				} catch (Exception e) {
					e.printStackTrace();
				}
				
				System.out.println("child thread end");
			}).start();
		}
		
	}

}
